<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>
            团购商品发布
        </h2>
    </div>
    <div class="tab-wrap">
        <ul class="tab-nav nav">
            <li data-tab="tab1" class="current"><a href="#">基础</a></li>
            <li data-tab="tab2" ><a href="#">扩展</a></li>
        </ul>
        <div class="tab-content">
            <form id="form" action="{:U('')}" method="post" class="form-horizontal">
                <div id="tab1" class="tab-pane tab1 in">
                    <!--TAB S-->
                    <div class="form-item cf">
                        <label class="item-label">商品名称<span class="check-tips">（输入商品的名称）</span></label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="proName" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">所属活动<span class="check-tips">（选择商品的所属活动）</span></label>
                        <div class="controls">
                            <select name="gpId" class="select input-large">
                                <volist name="data.list" id="vo">
                                    <option value="{$vo.id}">{$vo.gpName}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">商品简介<span class="check-tips">（输入商品简介）</span></label>
                        <div class="controls">
                            <label class="textarea input-large">
                                <textarea name="intro"></textarea>
                            </label>
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label">商品详情<span class="check-tips">（输入商品详情）</span></label>
                        <div class="controls">

                            {:hook('adminArticleEdit', array('name'=>'content'))}

                            <textarea name="content">{$data[$field['name']]}</textarea>
                        </div>
                    </div>
                    <!--tab e-->
                </div>
                <div id="tab2" class="tab-pane tab2">
                    <div class="form-item cf">
                        <label class="item-label">商品橱窗图片<span class="check-tips">(商品主图尺寸建议)</span></label>
                        <div class="controls">
                             
                                {:hook('UploadImages', array('name'=>"picarry",'value'=>""))}
                            
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">团购分级<span class="check-tips"><a href='#' class='btn btn-primary' id="addspec">添加新分级</a></span></label>
                        <div class="controls">
                            <div style="border: #000 1px solid;width: 50%" class='data-table table-striped'>
                                
                                <table >
                                    <thead><tr>
                                        <th>条件</th>
                                        <th>优惠</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody id="tbodyspec">
                                        <tr>
                                            <td>销量满：<input type="text" class="text input-small" name="saleCnt[]" value="" placeholder="" >份</td>
                                            <td>团购价为：<input type="text" class="text input-small" name="price[]" value="" placeholder="" >元</td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-item cf">
                        <label class="item-label">最大购买量</label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="maxCnt" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">最小购买量</label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="minCnt" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">已售量</label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="gpsaleCnt" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">果然价</label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="grprice" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">开团价</label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="gpprice" value="">
                        </div>
                    </div>
                    
                </div>
                <div class="form-item cf">
                    <button class="btn submit-btn ajax-post  " id="submit" type="submit" target-form="form-horizontal" autocomplete="off">发布商品</button>
                    <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </form>
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(document).ready(function () {
            $(".tab-nav > li").click(function () {
                var tab = $(this).data('tab');
                $(".tab-nav > li").removeClass('current');
                $(this).addClass('current');
                $(".tab-pane").removeClass('in');
                var obj = $('#' + tab);
                obj.addClass('in');
            });
            $('#addspec').click(function () {
                var html='<tr><td>销量满：<input type="text" class="text input-small" name="saleCnt[]" value="" placeholder="" >份</td><td>团购价为：<input type="text" class="text input-small" name="price[]" value="" placeholder="" >元</td><td><a href="#" class="btn btn-primary trdelspec">删除</a></td></tr>';
                $('#tbodyspec').append(html);
                
                $('.trdelspec').bind("click", function(){
                    $(this).parent().parent().remove();
                });
            });
        });
        
           highlight_subnav('{:U('GroupPurchase/proindex')}');
    </script>
</block>